package com.example.liapplycation;

import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;

import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

    }
    public void click1(View view) {
        EditText user=findViewById(R.id.user);
        String u = user.getText().toString();
        EditText password=findViewById(R.id.password);
        String p = password.getText().toString();
        if(u.equals("lzq")&&p.equals("123456")){
            AlertDialog dialog=new AlertDialog.Builder(this).setTitle("信息提示框").setPositiveButton("确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {

                }
            })
                    .setMessage("登录成功")
                    .create();
            dialog.show();
        }
       else{
           AlertDialog dialog=new AlertDialog.Builder(this).setTitle("信息提示框").setPositiveButton("确定", new DialogInterface.OnClickListener() {
               @Override
               public void onClick(DialogInterface dialog, int which) {

               }

           }).setMessage("登陆失败请注册").create();
           dialog.show();
        }
    }
    public void click2(View view) {
        Intent intent=new Intent();
        intent.setClass(this, REGISTER.class);
        startActivity(intent);
    }
}